bash-completion: add completion for `ostree sign`
authorDenis Pynkin <denis.pynkin@collabora.com>
Fri, 1 Nov 2019 00:00:13 +0000 (03:00 +0300)
committerDenis Pynkin <denis.pynkin@collabora.com>
Wed, 25 Mar 2020 12:23:54 +0000 (15:23 +0300)
Add bash completion with supported options for signing command.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
bash/ostree

index 4aec588ba3d269f2e6811a007a65e46deee639dd..7256e40a4d768a8e95008d9f64307d375dcea2d5 100644 (file)
@@ -1484,6 +1484,48 @@ _ostree_show() {
     return 0
 }
 
+_ostree_sign() {
+    local boolean_options="
+        $main_boolean_options
+        --delete -d
+        --verify -v
+    "
+
+    local options_with_args="
+        --sign-type
+        --keys-file
+        --keys-dir
+        --repo
+    "
+
+    local options_with_args_glob=$( __ostree_to_extglob "$options_with_args" )
+
+    case "$prev" in
+        --keys-file|--keys-dir|--repo)
+            __ostree_compreply_dirs_only
+            return 0
+            ;;
+        $options_with_args_glob )
+            return 0
+            ;;
+    esac
+
+    case "$cur" in
+        -*)
+            local all_options="$boolean_options $options_with_args"
+            __ostree_compreply_all_options
+            ;;
+        *)
+            local argpos=$( __ostree_pos_first_nonflag $( __ostree_to_alternatives "$options_with_args" ) )
+
+            if [ $cword -eq $argpos ]; then
+                __ostree_compreply_commits
+            fi
+    esac
+
+    return 0
+}
+
 _ostree_static_delta_apply_offline() {
     local boolean_options="
         $main_boolean_options
@@ -1747,6 +1789,7 @@ _ostree() {
         reset
         rev-parse
         show
+        sign
         static-delta
         summary
     "